

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>设置个人资料</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="../../../layuiadmin/layui/css/layui.css" media="all">
  <link rel="stylesheet" href="../../../layuiadmin/style/admin.css" media="all">
</head>
<style>

</style>
<body>

  <div class="layui-fluid">
    <div class="layui-row layui-col-space15">
      <div class="layui-col-md12">
        <div class="layui-card">
          <div class="layui-card-header">用户信息</div>
          <div class="layui-card-body" pad15>
            <form class="layui-form" lay-filter="dataForm">
              <input type="text" name="id" class="layui-input" value="${(item.id)!}" style="display: none">
              <div class="layui-form-item">
                <label class="layui-form-label">姓名</label>
                <div class="layui-input-inline">
                  <input type="text" name="name" lay-verify="required"  class="layui-input" value="${(item.name)!}">
                </div>
              </div>
              <div class="layui-form-item">
                <label class="layui-form-label">性别</label>
                <div class="layui-input-inline">
                  <select name="sex" lay-verify="required" lay-filter="sex">
                    <option value="">请选择</option>
                    <option value="男">男</option>
                    <option value="女">女</option>
                  </select>
                </div>
              </div>
              <div class="layui-form-item">
                <label class="layui-form-label">年龄</label>
                <div class="layui-input-inline">
                  <input type="text" name="age" lay-verify="required"  class="layui-input" value="${(item.age)!}">
                </div>
              </div>
              <div class="layui-form-item">
                <label class="layui-form-label">电话</label>
                <div class="layui-input-inline">
                  <input type="text" name="phone" lay-verify="required"  class="layui-input" value="${(item.phone)!}">
                </div>
              </div>
              <div class="layui-form-item">
                <label class="layui-form-label">地址</label>
                <div class="layui-input-inline">
                  <input type="text" name="address" lay-verify="required"  class="layui-input" value="${(item.address)!}">
                </div>
              </div>

              <div class="layui-form-item">
                <div class="layui-input-block">
                  <button class="layui-btn" lay-submit lay-filter="aa">确认修改</button>
                </div>
              </div>
            </form>
            
          </div>
        </div>
      </div>
    </div>
  </div>

  <script src="${request.contextPath}/layuiadmin/layui/layui.js"></script>
  <script>
  layui.config({
    base: '../../../layuiadmin/' //静态资源所在路径
  }).extend({
    index: 'lib/index' //主入口模块
  }).use(['index', 'set','jquery','form','layer'],function (){
     var $=layui.$;
    var form = layui.form;
      var layer=layui.layer;


    //回显性别
    form.val('dataForm', {
      "sex": "${(item.sex)!}" // "name": "value"
    });



    //监听提交
    form.on('submit(aa)', function(data){
      console.log(111)
      $.ajax({
        type:"post",
        url: "${request.contextPath}/changeInfo",
        contentType:'application/json; charset=UTF-8',
        data: JSON.stringify(data.field),
        // data: {customer:data.field},
        // data:data.field,
        success: function(res) {
          if(res.code==200){
            //调用父页面的刷新
            parent.window.location.reload();
          }else {
            layer.alert(res.msg,{icon:2})
          }

        },
        error: function(res) {
          layer.alert(res.msg,{icon:2})
        }
      })
      return false;
    });





      $("#submit").click(function () {

   })





  });
  </script>
</body>
</html>